clear all; 
close all;
clc;



N = 1e7;
x=rand(1,N);
figure(1)

 hist(x);
xlabel('x'); 
xlim([10 ,22]);
a = 10; 
b = 22; 
x = x*(b-a) + a;
hist(x);
dx = 0.01;
[h, xb] = hist(x, a-dx/2:dx:b+dx/2);
figure(2)
p = h / (sum(h) * dx);
plot(xb, p);
ylim([0 1.1]);
xlabel('x'); 
ylabel('p(x)');
